<template>
  <div class="all">
    <el-card class="box-card">
      <span slot="header" class="title">共享车位系统</span>
      <el-form label-width="70px" style="width: 320px; margin: 20px auto">
        <el-form-item label="账 户">
          <el-input v-model="login_form.telephone"></el-input>
        </el-form-item>
        <el-form-item label="密 码">
          <el-input v-model="login_form.password" type="password"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" style="width: 115px" @click="go"
            >登 录</el-button
          >
          <el-button style="width: 115px" @click="zhuce()"
            >注 册</el-button
          >
        </el-form-item>
        <div style="margin-left: 70%; width: 120px">
          <el-link type="primary" @click="forget()">忘记密码?</el-link>
        </div>
      </el-form>
    </el-card>
  </div>
</template> 
<script>
export default {
  data() {
    return {
      login_form: {
        telephone: "",
        password: "",
      },
      form: {
        user_id: "",
        user_telephone: ""
      },
      roleList:{}
    };
  },
  methods: {
    go() {
      this.$axios
        .get("/login.do", {
          params:{
            user_telephone: this.login_form.telephone,
            user_password: this.login_form.password,
          }
        })
        .then((res) => {
          if (res.data.status == "1001") {
            alert(res.data.messages);
          } else if (res.data.status == "1002") {
            alert("该账户已冻结，请联系管理员");
          } else if (res.data.status == "1003") {
            alert(res.data.messages);
          } else if (res.data.status == "1004") {
            alert(res.data.messages);
            this.form = res.data.data;
            this.$router.push("/ChooseRole");
            sessionStorage.setItem("reset_telephone",this.form.user_telephone);
          } else {
            this.form = res.data.data;
            sessionStorage.setItem("userId", this.form.user_id);
            this.$router.push("/Index");
          }
        });
    },
    forget() {
      this.$router.push("/Forget");
    },
    zhuce(){
      this.$router.push("/Reset");
    }
  }
};
</script>

<style>
.all {
  border: 1px solid white;
  height: 750px;
  background-image: url("../assets/beijing.jpg");
  background-size: 100% 100%;
}
.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}
.clearfix:after {
  clear: both;
}
.title {
  text-align: center;
  font-size: 24px;
  color: rgba(50, 50, 50, 0.8);
}
.box-card {
  background-color: aliceblue;
  border-radius: 10px;
  width: 480px;
  margin: 10% auto;
}
</style>